package com.linktel.productionLine.controller;

import com.linktel.productionLine.common.BaseResponse;
import com.linktel.productionLine.common.ResultUtils;
import com.linktel.productionLine.entity.dto.worksheetYieldInfo.WsSerialDTO;
import com.linktel.productionLine.service.WorksheetYieldInfoService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author HuangJiaHui
 * @Date 2023/9/27 10:22
 */

@RestController
@RequestMapping("/worksheet-yield-info")
@AllArgsConstructor
public class WorksheetYieldInfoController {
    private WorksheetYieldInfoService worksheetYieldInfoService;

    @GetMapping("getProductCode")
    public BaseResponse<String> getProductCodeByWsSerialIdFromWorksheetYield(String wsSerialNumber) {
        return ResultUtils.success(worksheetYieldInfoService.getProductCode(wsSerialNumber));
    }
    @GetMapping("listProductCode")
    public BaseResponse<List<String>> listProductCodeFromWorksheetYield() {
        return ResultUtils.success(worksheetYieldInfoService.listProductCode());
    }
    @GetMapping("listWsSerialNumber")
    public BaseResponse<List<WsSerialDTO>> listWsSerialNumberFromWorksheetYield(String productCode) {
        return ResultUtils.success(worksheetYieldInfoService.listWsSerialNumber(productCode));
    }
}
